<?php
header("content-type:text/html; charset=utf-8");
$servername = "localhost";
$username = "root";
$password_sql = "123";
$dbname = "test";
//mysql_query("set names 'utf8'");
// 创建连接
$conn = new mysqli($servername, $username, $password_sql, $dbname);
// 检测连接	
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}
$stmt = $conn->prepare("INSERT INTO user (userName,IPaddress,loginTime) VALUES (?,?,?)");
$stmt->bind_param("ssssddiss",$userName,$password,$loginTime);
$userName=$_GET["userName"];
$password=$_GET["password"];
$loginTime=date("Y-m-d h:i:sa");
$stmt->execute();
echo "新记录插入成功";
$stmt->close();
$conn->close();
?> 